package com.qf.core.exception;

import com.qf.core.response.ResponseCode;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
 * @Author: sin
 * @Date: 2025/5/5 14:32
 * @Description: 自定义异常
 **/
@Getter
@NoArgsConstructor
public class BaseException extends RuntimeException{

    /**
     * 异常码
     */
    private Integer code;

    /**
     * 异常信息
     */
    private String errMessage;

    public BaseException(ResponseCode r) {
        super(r.getDesc()); // 设置异常信息
        this.errMessage = r.getDesc();
        this.code = r.getCode();
    }
    public BaseException(Integer code, String message) {
        super(message);
        this.code = code;
        this.errMessage = message;
    }

}
